import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:flame/extensions.dart';
import 'package:flamedemo/game/MyGame.dart';
import 'package:flutter/material.dart';

class MyBorder extends PositionComponent
    with HasGameRef<MyGame>, CollisionCallbacks {
  RectangleHitbox ret = RectangleHitbox();

  @override
  Future<void> onLoad() async {
    size = gameRef.size - Vector2(50, 50);
    position = Vector2(((gameRef.size / 2) - size / 2).x, 45);
    ret.size = size - Vector2(1, 10);
    add(ret);
  }

  @override
  void render(Canvas canvas) {
    Paint paint = Paint();
    paint.color = Colors.white;
    paint.style = PaintingStyle.stroke;
    canvas.drawRect(Rect.fromLTWH(0, 0, size.x, size.y), paint);
  }
}
